package com.cuitrip.business.order.detail.orderstatus.traveller;

import com.cuitrip.business.order.detail.orderstatus.BaseOrderFormPresent;
import com.cuitrip.business.order.detail.ui.ITravelerOrderDetailView;
import com.cuitrip.business.order.detail.ui.model.OrderCancelReasonRenderData;
import com.cuitrip.business.order.detail.ui.model.PricePartRenderData;
import com.cuitrip.business.order.model.OrderItem;
import com.cuitrip.service.R;
import com.cuitrip.util.ResourceUtil;

/**
 * Created by baziii on 15/8/11.
 */
public class TravellerUnvaliablePresent extends BaseOrderFormPresent<ITravelerOrderDetailView> {

    public TravellerUnvaliablePresent(ITravelerOrderDetailView orderDetailView, OrderItem orderItem) {
        super(orderDetailView, orderItem);
    }

    @Override
    public void render() {
        mOrderDetailView.renderUi(build(mOrderItem));
    }

    @Override
    public void clickBottomAction() {
    }

    @Override
    public void clickBottomText() {

    }

    @Override
    public OrderCancelReasonRenderData buildOrderCancelReasonData(OrderItem orderItem){
        if (orderItem.isCancelled()){
            return new OrderCancelReasonRenderData(ResourceUtil.getString(R.string.book_cancel_reason), getUnvaliableReason(orderItem));
        }else{
            return new OrderCancelReasonRenderData(ResourceUtil.getString(R.string.book_expired_reason), getUnvaliableReason(orderItem));
        }
    }


    @Override
    public String getBottomActionText(OrderItem orderItem) {
        return "";
    }

    @Override
    public String getBottomText(OrderItem orderItem) {
        return "";
    }

    @Override
    public BottomButtonStyle getBottomButtonStyle(OrderItem orderItem) {
        return BottomButtonStyle.NONE;
    }

    public PricePartRenderData buildPriceInfoData(OrderItem orderItem) {
        PricePartRenderData renderData = copyFromOrderItem(orderItem);
        if (orderItem.hasPay()){
            renderData.setPriceMode(PricePartRenderData.PriceMode.Detail);
        }else{
            renderData.setPriceMode(PricePartRenderData.PriceMode.Simple);
        }

        return renderData;
    }

}
